<?php

namespace common\models\user;

use Yii;

/**
 * This is the model class for table "{{%user_collect}}".
 *
 * @property string $id 收藏ID
 * @property string $user_id 收藏用户UID
 * @property string $model 收藏模型：article，thread等
 * @property string $model_id 收藏内容主键
 * @property string $content
 * @property string $created_at 收藏时间
 * @property string $updated_at
 */
class UserCollect extends \common\db\ActiveRecord {

    use \common\traits\TimestampBehavior;
    use \common\traits\QueryInstanceActiveRecord;

    const MODEL_ARTICLE = 'article';
    const MODEL_DYNAMIC = 'dynamic';

    /**
     * @inheritdoc
     */
    public static function tableName() {
        return '{{%user_collect}}';
    }

    /**
     * @inheritdoc
     */
    public function rules() {
        return [
            [['user_id', 'model_id', 'created_at', 'updated_at'], 'integer'],
            [['model'], 'required'],
            [['content'], 'string'],
            [['model'], 'string', 'max' => 50],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels() {
        return [
            'id' => '收藏ID',
            'user_id' => '收藏用户UID',
            'model' => '收藏模型：article，thread等',
            'model_id' => '收藏内容主键',
            'content' => 'Content',
            'created_at' => '收藏时间',
            'updated_at' => 'Updated At',
        ];
    }

}
